#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
主题: 以指定列宽格式化字符串
问题: 你有一些长字符串，想以指定的列宽将它们重新格式化。
提示:
"""
import textwrap

s = "Look into my eyes, look into my eyes, the eyes, the eyes, \
the eyes, not around the eyes, don't look around the eyes, \
look into my eyes, you're under."

print(f"{s = }")

def recipe1():
    print(f"{textwrap.fill(s, 70) = }")
    print(f"{textwrap.fill(s, 40) = }")

    print(f"{textwrap.fill(s, 40, initial_indent='     ') = }")
    print(f"{textwrap.fill(s, 40, subsequent_indent='     ') = }")

def recipe2():
    """获取终端的大小尺寸"""
    import os
    print(f"{os.get_terminal_size().columns = }")

def main():
    print('recipe1'.center(20, '*'))
    recipe1()
    print('recipe2'.center(20, '*'))
    recipe2()

if __name__ == '__main__':
    main()             